{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=994
  Verdict: Accepted
}
const bad=-1;
var i,n,mi,mj,j:integer; max:int64; s:array[0..30001] of int64; a,b,h:array[1..30001] of integer; f:boolean;
procedure qsort(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
      while a[i]<x do inc(i);
      while a[j]>x do dec(j);
      if i<=j then begin
         y:=a[i];
         a[i]:=a[j];
         a[j]:=y;
         y:=b[i];
         b[i]:=b[j];
         b[j]:=y;
         inc(i);
         dec(j);
      end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
procedure qsort_h(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=h[(l+r) div 2];
repeat
      while h[i]<x do inc(i);
      while h[j]>x do dec(j);
      if i<=j then begin
         y:=h[i];
         h[i]:=h[j];
         h[j]:=y;
         inc(i);
         dec(j);
      end;
until i>j;
if l<j then qsort_h(l,j);
if i<r then qsort_h(i,r);
end;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
readln(n);
fillchar(s,sizeof(s),0);
for i:=1 to n do begin
    readln(a[i]);
    b[i]:=i;
end;
qsort(1,n);
s[1]:=a[1];
s[0]:=0;
for i:=2 to n do inc(s[i],s[i-1]+a[i]);
mi:=1;
mj:=1;
max:=a[1];
i:=1;
j:=2;
f:=false;
while f=false do begin
      inc(j);
      if a[i]+a[i+1]>=a[j] then begin
         if max<s[j]-s[i-1] then begin
            max:=s[j]-s[i-1];
            mj:=j;
            mi:=i;
         end;
         if j>=n then f:=true;
      end else begin
          inc(i);
          dec(j);
      end;
end;
writeln(mj-mi+1,' ',max);
j:=1;
for i:=mi to mj do begin
    h[j]:=b[i];
    inc(j);
end;
qsort_h(1,j-1);
for i:=1 to j-1 do writeln(h[i]);
end.